home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / editors / eedraw / src / eep / program.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-28  |  4.7 KB  |  171 lines

  1. /*****************************************************************************
  2. * Definitions for the EED printer driver program:                 *
  3. *****************************************************************************/
  4.  
  5. #ifndef PROGRAM_H
  6. #define PROGRAM_H
  7.  
  8.  
  9. #define EEDRAW_VERSION "Version 1.3"
  10.  
  11. #ifndef __MSDOS__
  12.  
  13. #ifdef mips                    /* SGI R2000/R3000 machines. */
  14. #define NO_VOID_PTR
  15. #define SYSV
  16. #endif /* mips */
  17.  
  18. char *malloc(unsigned int size);
  19.  
  20. #define searchpath(name) name
  21.  
  22. #ifndef M_PI
  23. #define M_PI 3.1415927
  24. #endif /* M_PI */
  25.  
  26. #endif /* __MSDOS__ */
  27.  
  28. #include "virtrstr.h"
  29.  
  30. typedef int        BooleanType;
  31. typedef unsigned char    ByteType;
  32. typedef double        RealType;
  33.  
  34. #ifdef VoidPtr
  35. #undef VoidPtr
  36. #endif /* VoidPtr */
  37.  
  38. #ifdef NO_VOID_PTR
  39. #define VoidPtr        char *
  40. #else
  41. #define VoidPtr        void *
  42. #endif /* NO_VOID_PTR */
  43.  
  44. #ifndef    NULL
  45. #define    NULL    0
  46. #endif
  47.  
  48. #ifndef    TRUE
  49. #define    TRUE    1
  50. #define    FALSE    0
  51. #endif
  52.  
  53. #ifndef LINE_LEN
  54. #define LINE_LEN    255
  55. #define LINE_LEN_SHORT    81
  56. #define FULL_PATH_LEN    81
  57. #define FILE_NAME_LEN    14
  58. #define MAX_PIN_INFO    10
  59. #endif
  60.  
  61. #define SIGN(x)        ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0))
  62. #define ABS(y)        ((y) > 0 ? (y) : (-(y)))
  63. #define SQR(y)        ((y) * (y))
  64. #define SGN(x)        ((x) > 0 ? 1 : ((x) == 0 ? 0 : -1))
  65. #define MIN(x, y)    ((x) > (y) ? (y) : (x))
  66. #define MAX(x, y)    ((x) > (y) ? (x) : (y))
  67. #define BOUND(x, Min, Max) (MIN(MAX((x), (Min)), (Max)))
  68. #define GEN_COPY(Dest, Src, Size)       memcpy(Dest, Src, Size)
  69.  
  70. #define INFINITY    1e6
  71. #define EPSILON        1e-6
  72.  
  73. #define DEG2RAD(Deg)    ((Deg) * M_PI / 180.0)
  74. #define RAD2DEG(Rad)    ((Rad) * 180.0 / M_PI)
  75.  
  76. #define BSPACE    8
  77. #define TAB    9
  78. #define LF    10
  79. #define CR    13
  80. #define ESC    27
  81.  
  82. #define PAGE_SCALER    1000        /* Mapping from page size in inches. */
  83. #define PAGE_A4_XSIZE    10.0                   /* Regular page size. */
  84. #define PAGE_A4_YSIZE    7.5
  85.  
  86. /* Note the snap distance is also the scaler for libraries loaded in. */
  87. #define DEFAULT_SNAP_DISTANCE    16        /* Distance to snap a point. */
  88.  
  89. typedef enum {
  90.     DRAW_POLYLINE_STRUCT_TYPE,
  91.     DRAW_CONNECTION_STRUCT_TYPE,
  92.     DRAW_TEXT_STRUCT_TYPE,
  93.     DRAW_LIB_ITEM_STRUCT_TYPE,
  94.     DRAW_PICK_ITEM_STRUCT_TYPE
  95. } DrawStructType;
  96.  
  97. typedef struct DrawGenericStruct {
  98.     DrawStructType StructType;
  99.     struct DrawGenericStruct *Pnext;
  100.     struct LayerStruct *Layer;
  101. } DrawGenericStruct;
  102.  
  103. typedef struct DrawPolylineStruct {
  104.     DrawStructType StructType;
  105.     struct DrawGenericStruct *Pnext;
  106.     char Layer;
  107.     TextWidthType Width;
  108.     int NumOfPoints;              /* Number of XY pairs in Points array. */
  109.     int *Points;            /* XY pairs that forms the polyline. */
  110. } DrawPolylineStruct;
  111.  
  112. typedef struct DrawConnectionStruct {
  113.     DrawStructType StructType;
  114.     struct DrawGenericStruct *Pnext;
  115.     char Layer;
  116.     int PosX, PosY;                /* XY coordinates of connection. */
  117. } DrawConnectionStruct;
  118.  
  119. typedef struct DrawTextStruct {
  120.     DrawStructType StructType;
  121.     struct DrawGenericStruct *Pnext;
  122.     char Layer;
  123.     int PosX, PosY, Scale;            /* XY coordinates of connection. */
  124.     TextOrientationType Orient;
  125.     char *Text;
  126. } DrawTextStruct;
  127.  
  128. typedef struct DrawLibItemStruct {
  129.     DrawStructType StructType;
  130.     struct DrawGenericStruct *Pnext;
  131.     TextOrientationType PartNameOrient, ChipNameOrient;
  132.     char *PartName;      /* Name of part, i.e. "Op. Amp. 21". Not Chip Name. */
  133.     char *ChipName;       /* Key to look for in the library, i.e. "74LS00". */
  134.     int PartNameX, PartNameY;            /* Where PartName should be put. */
  135.     int ChipNameX, ChipNameY;            /* Where ChipName should be put. */
  136.     int Multi;             /* In multi unit chip - which unit to draw. */
  137.     int Transform[2][2];       /* The rotation/mirror transformation matrix. */
  138.     int PosX, PosY;                  /* Exact position of part. */
  139.     int BBoxMinX, BBoxMaxX, BBoxMinY, BBoxMaxY;     /* BBox around the part. */
  140. } DrawLibItemStruct;
  141.  
  142.  
  143. typedef struct LayerStruct {
  144.     char LayerNames[45][8];
  145.     int  LayerColor[45];
  146.     char LayerStatus[45];
  147.     int  NumberOfLayers;
  148.     int CurrentLayer;
  149.     int CurrentWidth;
  150. }LayerStruct;
  151.  
  152.  
  153. typedef struct DrawPickedStruct { /* Holds structures picked by pick events. */
  154.     DrawStructType StructType;
  155.     struct DrawPickedStruct *Pnext;
  156.     DrawGenericStruct *PickedStruct;
  157. } DrawPickedStruct;
  158.  
  159. extern int EEPageSizeX, EEPageSizeY; /* Clipping boundaries of current page. */
  160. extern DrawGenericStruct *EEDrawList;         /* All objects are saved here. */
  161. extern char *EEPSFontName;                 /* EED-PS PS font name. */
  162. extern char *EEDataFileName;              /* EED-PS EED input file name. */
  163. extern LayerStruct *Layer;
  164.  
  165. VoidPtr MyMalloc(unsigned size);
  166. void MyFree(VoidPtr p);
  167. void MyExit(int ExitCode);
  168. void FatalError(char *ErrMsg);
  169.  
  170. #endif PROGRAM_H
  171.